<template>
	<view>
		<cu-custom :bgColor="'bg-'+ theme.themeColor" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">佣金提现</block>
		</cu-custom>
		<form @submit="submitForm">
			<view class="cu-form-group margin-top">
				<view class="title">银行名称</view>
				<input placeholder="请输入银行名称" v-model="form.bankName"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">银行卡号</view>
				<input placeholder="请输入银行卡号" v-model="form.bankCardNo"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">真实姓名</view>
				<input placeholder="请输入真实姓名" v-model="form.realName"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">提现金额</view>
				{{distributionUser.totalAmount-distributionUser.frozenAmount}}
				<vk-data-input-number-box v-model="form.applyAmount" :min="0.01"
					:max="distributionUser.totalAmount-distributionUser.frozenAmount" :positive-integer="false">
				</vk-data-input-number-box>
			</view>
			<view class="compile">
				<button class="cu-btn shadow-blur block margin-sm round bottom-btn" :class="'bg-'+ theme.themeColor"
					:disabled="submitDisabled" type="" formType="submit">提交</button>
			</view>
		</form>
	</view>
</template>
<script>
	import {
		getObj
	} from '@/api/distributionuser.js';
	import {
		addObj
	} from '@/api/withdrawalapply.js';
	export default {
		data() {
			return {
				theme: getApp().globalData.theme,
				distributionUser: {},
				submitDisabled: false,
				form: {}
			}
		},
		onLoad() {
			this.getData();
		},
		methods: {
			getData() {
				getObj({}).then(res => {
					this.distributionUser = res.data
				});
			},
			submitForm(e) {
				this.submitDisabled = true;
				addObj(this.form).then(response => {
					this.submitDisabled = false;
				uni.navigateTo({
					url:"/pages/user-withdrawal/withdrawal-record/index"
				})
				})
			}
		}
	}
</script>

<style>
</style>
